<%@ include file="../imports.jsp"%>

<%@ page import="org.openxava.model.meta.MetaProperty" %>
<%@ page import="org.openxava.web.Ids" %>
<%@ page import="java.io.File" %>

<%
String propertyKey = request.getParameter("propertyKey");
MetaProperty p = (MetaProperty) request.getAttribute(propertyKey);
String fvalue= (String) request.getAttribute(propertyKey + ".fvalue");
boolean editable="true".equals(request.getParameter("editable"));
String applicationName = request.getParameter("application");
String module = request.getParameter("module");
long dif=System.currentTimeMillis(); // to avoid browser caching
%>

<!--  <img id='<%=propertyKey%>' name='<%=propertyKey%>' src='<%=request.getContextPath()%>/xava/ximage?application=<%=applicationName%>&module=<%=module%>&property=<%=propertyKey%>&dif=<%=dif%>' title="<%=p.getDescription(request)%>" alt=""/> --> 
<!--  <a href="../download/<%=module %>/<%=fvalue.replace(File.separator,"/")%>"><%=fvalue.substring(fvalue.lastIndexOf(File.separator)+1,fvalue.length())%></a> -->
<a href="../download/<%=p.getLabelId().substring(0,p.getLabelId().indexOf(".")) %>/<%=fvalue.replace(File.separator,"/")%>"><%=fvalue.substring(fvalue.lastIndexOf(File.separator)+1,fvalue.length())%></a>

<input type="hidden" name="<%=propertyKey%>" value="<%=fvalue%>">
<% if (editable) { %>	
	<span valign='middle'>
		<xava:link action='FileEditor.subirFichero' argv='<%="fileProperty="+Ids.undecorate(propertyKey)%>'/>
		&nbsp;&nbsp;
	   	<xava:action action='FileEditor.eliminarFichero' argv='<%="fileProperty="+Ids.undecorate(propertyKey)%>'/> 
	</span>
	
<% } %>	